<template>
  <div class="Histogram">
    <div id="main" style="width: 500px;height:400px;"></div>
  </div>
</template>

<script>
export default {
  name: 'Histogram',
  methods:{
    myEcharts(){
      // 基于准备好的dom，初始化echarts实例
      var myChart = this.$echarts.init(document.getElementById('main'));

      // 指定图表的配置项和数据
      var option = {
        color:
            ['#409eff'],
        title: {
          text: '每周支出'
        },
        tooltip: {},
        legend: {
          data:['支出']
        },
        xAxis: {
          data: ["周一","周二","周三","周四","周五","周六"]
        },
        yAxis: {},
        series: [{
          name: '支出',
          type: 'bar',
          data: [5, 20, 36, 10, 10, 50]
        }]
      };

      // 使用刚指定的配置项和数据显示图表。
      myChart.setOption(option);
    }
  },
  mounted() {
    this.myEcharts();
  }
}
</script>

<style>

</style>
